package com.example.drop.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.drop.R
import com.example.drop.entity.TaskEntityItem

class TaskAdapter :BaseQuickAdapter<TaskEntityItem,BaseViewHolder>(R.layout.item_task) {
    override fun convert(holder: BaseViewHolder, item: TaskEntityItem) {
        holder.setText(R.id.task_Name,item.taskName)
        // helper.setText(R.id.task_type,item.patrolStatus)
        holder.setText(R.id.task_time,"任务时间："+item.patrolTime)
        val type = holder.getView<TextView>(R.id.task_type)
        if(item.patrolStatus=="0"){
            type.setBackgroundResource(R.drawable.bg_blue)
            type.setText("未巡检")
        }else if(item.patrolStatus=="1"){
            type.setBackgroundResource(R.drawable.bg_ju)
            type.setText("巡检中")
        }else if(item.patrolStatus=="2"){
            type.setBackgroundResource(R.drawable.bg_red)
            type.setText("已完成")
        }else{
            type.setBackgroundResource(R.drawable.bg_zhizhi)
            type.setText("已作废")
        }
    }
}